
//时间戳方法处理
export const Tl_timestamp = (format_num, type) => {
    let format = new Date(format_num)
    let year = format.getFullYear()
    let month = format.getMonth() + 1
    let date = format.getDate()
    let hour = format.getHours()
    let minute = format.getMinutes()
    let miao = format.getSeconds()
    if (type) {
        month = month < 10 ? '0' + month : month
        date = date < 10 ? '0' + date : date
        hour = hour < 10 ? '0' + hour : hour
        minute = minute < 10 ? '0' + minute : minute
        miao = miao < 10 ? '0' + miao : miao
    }
    return [year, month, date, hour, minute, miao]
}
//回一个日期格式传递一个时间戳如1920-02-12 10:25:10
export const Tl_timestamp2 = (format1) => {
    let format = new Date(format1)
    let year = format.getFullYear()
    let month = format.getMonth() + 1
    let date = format.getDate()
    let hour = format.getHours()
    let minute = format.getMinutes()
    let miao = format.getSeconds()
    let returnstr = function (val) {
        return val < 10 ? '0' + val : val
    }
    return (
        returnstr(year) +
        '-' +
        returnstr(month) +
        '-' +
        returnstr(date) +
        ' ' +
        returnstr(hour) +
        ':' +
        returnstr(minute) +
        ':' +
        returnstr(miao)
    )
}